//
//  SSSMyIncomeViewCell.m
//  SSSMerchant
//
//  Created by xnxin on 2017/3/20.
//  Copyright (c) 2017 xnxin. All rights reserved.
//

#import "SSSMyIncomeViewCell.h"
#import "SSSMyIncomeViewCellModel.h"
#import "UIColor+Hexadecimal.h"
#import <QMUIKit/QMUIKit.h>


@interface SSSMyIncomeViewCell()

@property(readonly) SSSMyIncomeViewCellModel *model;

@end

@implementation SSSMyIncomeViewCell
@dynamic model;


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {

    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {

        self.iconImageView = [UIImageView new];
        self.detailImageView = [UIImageView new];
        
        [self addSubview:self.iconImageView];
        [self addSubview:self.detailImageView];
        
        self.accessoryView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"icon_arrows_right2"]];
        self.layer.borderColor = [[UIColor colorWithHex:@"BBBBBB"] CGColor];
        self.layer.borderWidth = 1;

        [_grayline removeFromSuperview];
        [self setupConstraint];
    }
    return self;
}

- (void)setupConstraint {

    [self.iconImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(self.mas_centerY);
        make.left.equalTo(self).offset(15);
    }];

    [self.detailImageView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.centerY.equalTo(self.mas_centerY);
        make.right.equalTo(self.mas_rightMargin).offset(-70);
    }];
}

- (void)setModel:(SSSMyIncomeViewCellModel *)model {

    self.iconImageView.image = [UIImage imageNamed:model.imgName];
    self.detailImageView.image = [UIImage imageNamed:model.deteailImgName];
}

@end
